import java.io.*;

class MyLineNumberReader extends MyBufferedReader
{
	private int number;

	MyLineNumberReader(Reader r)
	{
		super(r);
	}
	public String myReadLine()throws IOException
	{

		number++;
		return super.myReadLine();

	}

	public void setNumber(int number)
	{
		this.number =  number;
	}
	public int getNumber()
	{
		return number;
	}
}

/*
class MyLineNumberReader 
{
	private Reader r;
	private int number;

	MyLineNumberReader(Reader r)
	{
		this.r = r;
	}
	public String myReadLine()throws IOException
	{

		number++;
		StringBuilder sb = new StringBuilder();

		int ch = 0;
		while((ch=r.read())!=-1)
		{
			if(ch=='\r')
				continue;
			if(ch=='\n')
				return sb.toString();
			sb.append((char)ch);

		}

		if(sb.length()!=0)
			return sb.toString();
		return null;

	}

	public void setNumber(int number)
	{
		this.number =  number;
	}
	public int getNumber()
	{
		return number;
	}
	public void myClose()throws IOException
	{
		r.close();
	}
}

*/
class  MyLineNumberReaderDemo
{
	public static void main(String[] args) throws IOException
	{
		FileReader fr = new FileReader("PersonDemo.java");

		MyLineNumberReader lnr = new MyLineNumberReader(fr);

		String line = null;
		
		lnr.setNumber(1000);
		
		while((line=lnr.myReadLine())!=null)
		{
			System.out.println(lnr.getNumber()+"::"+line);
			
		}
		lnr.myClose();
	}
}
